<template>
  <fieldset>
    <legend>Input组件</legend>
    <input type="text" v-model="val"><span>{{input}}</span>

    <!-- 子组件 -->
    <ListOne :data="val" @to-parent="receive"></ListOne>



  </fieldset>
</template>
<script> 
import ListOne from "./ListOne.vue"
//获取输入框的值
//再子组件的标签上使用v-bind动态绑定一个属性data
export default {
    data () {
        return {
            val:"",
            input:""
        }
    },
    methods: {
        receive(input){
            console.log(input);
            this.input=input
            this.val=""
        }
    },
    components: {
        ListOne
    }
}
</script>